<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>按从大到小排序</title>
</head>

<body>
    <script>
        var a = prompt('请输入a的值');
        var b = prompt('请输入b的值');
        var c = prompt('请输入c的值');
        var d = prompt('请输入d的值');
        var e = prompt('请输入e的值');
        var f = prompt('请输入f的值');
        var g = prompt('请输入g的值');
        var h = prompt('请输入h的值');
        var arr = new Array(a, b, c, d, e, f, g, h);
        var exchange = 0;
        for (var i = 1; i < arr.length; i++) {
            for (var j = 0; j < arr.length - i; j++) {
                if (arr[j] < arr[j + 1]) {
                    exchange = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = exchange;
                }
            }
        }
        alert(arr + ',');
    </script>
</body>

</html>